/***********************************************************************************/
/* Code license:  GNU General Public License v3                                    */
/* Main page:     https://code.google.com/p/library-cross-platform/                */
/* Issue tracker: https://code.google.com/p/library-cross-platform/issues/list     */
/***********************************************************************************/

#include "math_x.h"
#include <math.h>

double _atanh(const double & v)
{
  double ret_val = (v + 1.) / (v - 1.);
  double is_minus = (ret_val < 0) ? -1 : 1;
  ret_val = log(ret_val * is_minus);
  ret_val = ret_val * 0.5;
  return ret_val;
}

div_t double_transform(const double &v, int digits)
{
  div_t  result;
  double d_rem;
  result.quot =  (int)v;
  d_rem       = v - result.quot;

  while(digits --)
   d_rem *= 10;

  result.rem = d_rem;
  return result;
}

